//
//  NSString+Url.m
//  RM_IM
//
//  Created by zhangzhenyun on 2018/7/20.
//  Copyright © 2018年 user1. All rights reserved.
//

#import "NSString+Url.h"

@implementation NSString (Url)

+ (NSString *)transFormUrlIncludeChineseToEnglish:(NSString *)chineseUrl {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
    if (@available(iOS 9.0 ,*)) {
        chineseUrl =  [chineseUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@"`#%^{}\"[]|\\<> "].invertedSet];
    } else {
        chineseUrl = [chineseUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    }
#pragma clang diagnostic pop
    return chineseUrl;
}

@end
